import os

basedir = os.path.abspath(os.path.dirname(__file__))

class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'xuxin'
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    @staticmethod
    def init_app(app):
        pass

class DevelopmentConfig(Config):
    DEBUG = True
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@127.0.0.1:3306/repair'\
        .format(os.environ.get('MYSQL_USERNAME'), os.environ.get('MYSQL_PASSWORD'))
    SQLALCHEMY_TRACK_MODIFICATIONS = True


class OfficialConfig(Config):
    DEBUG = False
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{}:{}@127.0.0.1:3306/repair' \
        .format(os.environ.get('MYSQL_USERNAME'), os.environ.get('MYSQL_PASSWORD'))
    SQLALCHEMY_TRACK_MODIFICATIONS = True


config = {
    'development': DevelopmentConfig,
    'official': OfficialConfig,

    'default': DevelopmentConfig
}